-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
this additionally adds a metric to track the number of items in the in-memory cache.
ea14662
to
913132d
Compare
merino-cache/src/memory.rs
Outdated
@@ -174,6 +176,13 @@ impl Suggester { | |||
?removed_storage, | |||
"finished removing expired entries from cache" | |||
); | |||
|
|||
metrics_client | |||
.count("cache.memory.storage_len", items.len_storage() as i64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this the first time, but this needs to be metrics_client.gauge
, not .count
. That's because count
is equivalent to incr
, but with a larger step. (more specifically, incr
is count
with n = 1). With count we'd end up with a graph of the integral of the cache size overtime, which definitely isn't what we want.
merino-cache/src/memory.rs
Outdated
.take(2) | ||
.map(|x| String::from_utf8(x).unwrap()) | ||
.collect(); | ||
assert!(collected_data.contains(&"merino-test.cache.memory.storage_len:1|c".to_string())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs updating per the gauge type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right. thanks.
docs/data.md
Outdated
- `cache.memory.pointers-len` - A counter representing the number of entries in | ||
the first level of hashing in the in-memory deduped hashmap. | ||
|
||
- `cache.memory.storage-len` - A counter representing the number of entries in | ||
the second level of hashing in the in-memory deduped hashmap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `cache.memory.pointers-len` - A counter representing the number of entries in | |
the first level of hashing in the in-memory deduped hashmap. | |
- `cache.memory.storage-len` - A counter representing the number of entries in | |
the second level of hashing in the in-memory deduped hashmap. | |
- `cache.memory.pointers-len` - A gauge representing the number of entries in | |
the first level of hashing in the in-memory deduped hashmap. | |
- `cache.memory.storage-len` - A gauge representing the number of entries in | |
the second level of hashing in the in-memory deduped hashmap. |
Note: this is based on #205 and will need to be rebased after that gets merged.
This additionally adds a metric to track the number of items in the in-memory cache. Note that this does not add the same count of items for the Redis cache, as it's slightly more involved there and I'd take it as a separate, specific PR.
This contributes toward #207 , but follow-up work is required to fix it.